|
ResourceSharedPtr | acquireResource (const ResourceID &id) const |
| Acquires a resource from the node or the node's closest ancestor having the resource id in the resource dictionary.
|
|
template<typename T > |
shared_ptr< T > | acquireResource (const ResourceID &id) const |
| Acquires a resource from the node or the node's closest ancestor having the resource id in the resource dictionary, and casts the resource to given type.
|
|
ResourceManager::AcquireTaskSharedPtr | acquireResourceAsync (const ResourceID &key, ResourceManager::AsyncAcquireFinishedCallback func) const |
| Posts an asynchronous task to acquire a resource.
|
|
ResourceDictionarySharedPtr | acquireResourceDictionary () |
| Gets a resource dictionary of a node.
|
|
virtual bool | addAbstractChildOverride (NodeSharedPtr child)=0 |
|
void | addAnonymousResource (ResourceSharedPtr resource) |
| Adds alias resource to an object node.
|
|
void | addInputManipulator (InputManipulatorBaseSharedPtr inputManipulator) |
| Transfers the ownership and attaches an input manipulator to an object node.
|
|
template<typename TMessageType > |
MessageSubscriptionToken | addMessageFilter (const TMessageType &messageType, typename TMessageType::FunctionType function) |
| Adds a message filter where the filter is a function.
|
|
template<typename TMessageType , typename TClass , typename TClassMethod > |
MessageSubscriptionToken | addMessageFilter (TMessageType &messageType, TClass *messageHandlerObject, TClassMethod method) |
| Adds a message filter where the filter is a method that is invoked on an object.
|
|
template<typename TMessageType > |
MessageSubscriptionToken | addMessageHandler (const TMessageType &messageType, typename TMessageType::FunctionType function) |
| Adds a message handler where the handler is a function.
|
|
template<typename TMessageType > |
MessageSubscriptionToken | addMessageHandler (const TMessageType &messageType, typename TMessageType::FunctionType function, Node *messageSourceFilter) |
| Adds a message handler where the handler is a function and you explicitly define the accepted source.
|
|
template<typename TMessageType , typename TClass , typename TClassMethod > |
MessageSubscriptionToken | addMessageHandler (TMessageType &messageType, TClass *messageHandlerObject, TClassMethod method) |
| Adds a message handler where the handler is a method that is invoked on an object.
|
|
void | addNodeComponent (NodeComponentSharedPtr nodeComponent) |
| Transfers the ownership of a node component to an object node.
|
|
void | addNodeComponentWithOwner (NodeComponentSharedPtr nodeComponent, const void *owner) |
| Transfers the ownership of a node component to an object node and sets the owner of the node component.
|
|
void | addNodeReference (AbstractPropertyType propertyType, AbstractNodeReference *reference) |
|
void | addResource (const ResourceID &resourceId, string_view resourceUrl) |
| Adds a resource manager resource to an object node. If resourceID already exists in object, removes the existing entry. If resourceURL is NULL, error is thrown. */.
|
|
void | addResourceDictionary (ResourceDictionarySharedPtr resourceDictionary) |
| Adds a nested resource dictionary to the resource dictionary of a node.
|
|
void | addResourceReference (AbstractPropertyType propertyType, AbstractResourceReference *reference) |
| This is a helper for automatic resource tracking in ResourceReference.
|
|
template<typename TMessageType , typename TClass , typename TClassMethod > |
MessageSubscriptionToken | addTunnelingFilter (const TMessageType &messageType, TClass *messageHandlerObject, TClassMethod method) |
| Adds a message filter where the filter is a method that is invoked on an object.
|
|
template<typename TMessageType > |
MessageSubscriptionToken | addTunnelingFilter (const TMessageType &messageType, typename TMessageType::FunctionType function) |
| Adds a message filter where the filter is a function.
|
|
template<typename TMessageType > |
MessageSubscriptionToken | addTunnelingHandler (const TMessageType &messageType, typename TMessageType::FunctionType function, Node *messageSourceFilter) |
| Adds a message handler where the handler is a function and you explicitly define the accepted source.
|
|
AppliedStyleEntrySharedPtr | applyManualStyle (StyleSharedPtr style) |
| Applies a style to an object node.
|
|
AppliedStyleEntrySharedPtr | applyStyle (StyleSharedPtr style) |
| Applies a style to an object node.
|
|
void | applyStyles () |
| Apply all styles for an object node.
|
|
void | applyStylesRecursive () |
| Applies styles recursively.
|
|
void | attachRecursive () |
| Attaches an object node and its children recursively.
|
|
InputManipulatorConstIterator | beginInputManipulators () const |
|
NodeComponentConstIterator | beginNodeComponents () const |
|
void | clearChangeFlag (uint32_t flag) |
| Clears a change flag.
|
|
void | clearChildChangeFlag (uint32_t flag) |
| Clears a child change flag.
|
|
bool | containsResource (const ResourceID &resourceID) const |
| Returns if object node resource dictionary contains the resource with given ID. Resource can be any type: style, alias or resource manager resource. */.
|
|
BindingLookupContextPtr | createLookupContext (NodeSharedPtr templateRoot) |
| Creates a lookup context for the node.
|
|
void | detachRecursive () |
| Detaches a node and its descendants.
|
|
void | dispatchAbstractMessage (const AbstractMessageType &messageType, MessageArguments &messageArguments) |
| Dispatches a message from this node with specified arguments.
|
|
template<typename TArgumentsType > |
void | dispatchMessage (const MessageType< TArgumentsType > &messageType, typename MessageType< TArgumentsType >::ArgumentsType &messageArguments) |
| Dispatches a message from this node with specified arguments.
|
|
InputManipulatorConstIterator | endInputManipulators () const |
|
NodeComponentConstIterator | endNodeComponents () const |
|
template<typename TNodeType > |
shared_ptr< TNodeType > | findAbstractChild (string_view name) |
| Find a child by name. Finds direct children as well as children connected indirectly for example Viewport->Scene.
|
|
optional< string > | findResourceURL (const ResourceID &resourceId) const |
| Tries to find Resource URL for Resource ID from this node.
|
|
virtual size_t | getAbstractChildCountOverride ()=0 |
|
virtual size_t | getAbstractChildIndexOverride (const Node &node)=0 |
|
virtual NodeSharedPtr | getAbstractChildOverride (size_t index)=0 |
|
template<typename DataType > |
DataType | getAbstractProperty (AbstractPropertyType abstractPropertyType) const |
|
uint32_t | getChangeFlags () const |
| Get current change flags.
|
|
uint32_t | getChildChangeFlags () const |
| Get current child change flags.
|
|
FocusManager * | getFocusManager () const |
| Returns the Focus Manager associated with the Screen node to which this node belongs.
|
|
FocusScope * | getFocusScopeInfo () const |
| Returns the information about the focus scope for a node.
|
|
InputManager * | getInputManager () const |
| Returns the Input Manager associated with the Screen node to which this node belongs.
|
|
AbstractPropertyTypeDescriptor::ValueSource * | getNodeFinalValueSource (AbstractPropertyTypeDescriptor &descriptor) const |
|
template<typename DataType > |
optional< typename PropertyType< DataType >::DataType > | getOptionalAbstractProperty (AbstractPropertyType abstractPropertyType) const |
|
template<typename DataType > |
optional< typename PropertyType< DataType >::Traits::ReturnType > | getOptionalProperty (const PropertyType< DataType > &propertyType) const |
| Evaluates the property value in the same way as the overload above but does not default to the value in property metadata if there are no inputs to the property value.
|
|
Node * | getParent () const |
| Returns the parent of the node.
|
|
template<typename DataType > |
PropertyType< DataType >::Traits::ReturnType | getProperty (const PropertyType< DataType > &propertyType) const |
| Returns the current value of a property.
|
|
ResourceDictionarySharedPtr | getResourceDictionary () const |
| If a node has a resource dictionary, returns the resource dictionary of that node.
|
|
Screen * | getScreen () const |
| Returns the Screen node to which this node belongs.
|
|
NodeSharedPtr | getTemplateRoot () const |
| Gets the template root of this node.
|
|
void | invalidateArrange () |
| Invalidates arrange.
|
|
void | invalidateDraw () |
| Invalidates draw flag for the node.
|
|
void | invalidateFinalTransform () |
| Invalidates final transform for node.
|
|
void | invalidateMeasure () |
| Invalidates measure for the node.
|
|
void | invalidateRender () |
| Invalidates render for node.
|
|
bool | isAnyChangeFlagSet (uint32_t flag) const |
| Checks if any of given flags is set.
|
|
bool | isAnyChildChangeFlagSet (uint32_t flag) const |
| Checks if any child change flags (corresponding to given mask) are set.
|
|
bool | isAttached () const |
| Returns true if the node is attached to a screen or one of its descendants.
|
|
bool | isAttaching () const |
| Returns true if node is in the process of attaching, false otherwise.
|
|
bool | isChangeFlagSet (uint32_t flag) const |
| Checks if a change flag is set.
|
|
bool | isChildChangeFlagSet (uint32_t flag) const |
| Checks if child change flags match.
|
|
bool | isDetaching () const |
| Returns true if the node currently detaching.
|
|
bool | isEffectivelyFocusable () const |
| Returns whether a node is focusable.
|
|
bool | isEffectivelyVisible () const |
| Returns whether a node and its ancestor nodes are visible.
|
|
bool | isInitialized () const |
| Returns true if initialize() has been called, false otherwise.
|
|
bool | isInvalidArrange () const |
| Checks if the node needs arrange.
|
|
bool | isInvalidDraw () |
| Tells if node draw flag is invalid.
|
|
bool | isInvalidFinalTransform () const |
| Tells if final transform flag is invalid for node.
|
|
bool | isInvalidMeasure () const |
| Check if the node needs measure.
|
|
bool | isInvalidRender () const |
| Returns if node render flag is invalid.
|
|
bool | isNamed (string_view name) const |
|
| KZ_METACLASS_PROPERTY_TYPE (FontFamilyProperty) |
|
template<typename Type > |
shared_ptr< Type > | lookupNode (string_view pathOrKey) |
| Returns a node of specified type by looking it up with specified path or alias.
|
|
template<typename Type > |
shared_ptr< Type > | lookupNodeComponent (string_view name) |
| Returns a node component of specified type by looking it up with specified name.
|
|
Node * | lookupNodeRaw (string_view relativePath) |
| Get an object node by another node and a relative path.
|
|
ObjectSharedPtr | lookupObject (string_view relativePath) |
| Lookup for an object from a node.
|
|
template<typename Type > |
shared_ptr< Type > | lookupObject (string_view relativePath) |
| Lookup for an object from a node.
|
|
tuple< NodeSharedPtr, AbstractPropertyType > | lookupObjectForStateManager (string_view relativePath) |
| Lookup for an node and possible object from within the node for state manager.
|
|
virtual bool | moveAbstractChildToPositionOverride (NodeSharedPtr child, size_t index)=0 |
| Moves a child node to a given position in the list of child nodes.
|
|
void | notifyResourceDictionaryModified () |
| Forces the re-evaluation of resource IDs in a node tree.
|
|
virtual bool | removeAbstractChildOverride (Node &child)=0 |
|
void | removeAnonymousResource (const Resource &resource) |
| Removes anonymous resource from object node resources.
|
|
void | removeInputManipulator (InputManipulator &inputManipulator) |
| Removes the ownership and detaches an input manipulator from an object node.
|
|
void | removeKZBData () |
| Destroys all object node data loaded from KZB.
|
|
void | removeKZBData (flat_set< AbstractPropertyType > *keepProperties) |
| Destroys all object node data loaded from KZB, including properties, bindings, node components, resources etc.
|
|
void | removeMessageHandler (MessageSubscriptionToken token) |
| Removes a message subscription.
|
|
void | removeNodeComponent (NodeComponent &nodeComponent) |
| Removes the ownership of a node component from an object node.
|
|
void | removeNodeComponentWithOwner (const void *owner) |
| Removes all bindings with the specified owner.
|
|
void | removeNodeReference (const AbstractNodeReference &reference) |
|
void | removeResource (const ResourceID &resourceId) |
| Removes a resource with given ID from object node resource dictionary. Does not do anything if resourceID was not found. */.
|
|
void | removeResourceReference (const AbstractResourceReference &reference) |
| This is a helper for automatic resource tracking in ResourceReference.
|
|
virtual void | restoreResources () |
| Reattaches an object node after potential resource change.
|
|
void | setChangeFlag (uint32_t flag) |
| Sets a change flag.
|
|
void | setChildChangeFlag (uint32_t flag) |
| Sets a child change flag.
|
|
void | setParent (Node *parent) |
| Kanzi uses this method internally to set the parent of a node.
|
|
void | setResourceDictionary (ResourceDictionarySharedPtr resourceDictionary) |
| Replaces the resource dictionary of a node.
|
|
void | setScreen (Screen *screen) |
| Sets the Screen node to which this node belongs.
|
|
void | setTemplateRoot (NodeSharedPtr templateRoot) |
| Sets the template root of this node.
|
|
ResourceSharedPtr | tryAcquireResource (const ResourceID &id) const |
| Acquires a resource from the node or the node's closest ancestor having the resource id in the resource dictionary.
|
|
template<typename T > |
shared_ptr< T > | tryAcquireResource (const ResourceID &id) const |
| Acquires a resource from the node or the node's closest ancestor having the resource and casts the resource to given type.
|
|
KZ_DEPRECATED NodeSharedPtr | trySetActiveFocus () |
| Tries to move the focus on this node.
|
|
NodeSharedPtr | trySetFocus () |
| Tries to move the focus to this node.
|
|
NodeSharedPtr | trySetFocus (FocusFallback fallbackOption) |
| Tries to set the focus to the newFocusNode using FocusManager::trySetFocus() but with a fallback behavior in case the node does not gain focus.
|
|
void | unapplyStyle (AppliedStyleEntrySharedPtr appliedStyleEntry) |
| Unapplies a style from an object node.
|
|
void | unapplyStyles () |
| Unapplies and removes all applied styles.
|
|
void | unapplyStylesRecursive () |
| Unapplies styles recursively.
|
|
void | validateArrange () |
| Validates arrange.
|
|
void | validateDraw () |
| Validates draw flags for the node.
|
|
void | validateDrawForChildrenRecursive () |
| Recursively validates draw for the children from this 2D node onwards.
|
|
void | validateMeasure () |
| Validates measure for the node.
|
|
void | validateRender () |
| Validates render for node.
|
|
VisitorResult | visit (const Visitor &visitor, VisitorOrder order) |
| Visits a node and its descendants.
|
|
VisitorResult | visitDescendants (const Visitor &visitor, VisitorOrder order) |
| Visits the descendants of a node.
|
|
| ~Node () override |
| Destructor.
|
|
AppliedStyleEntrySharedPtr | applyObjectStyle (kanzi::StyleSharedPtr style) |
| Applies a style to an object.
|
|
void | applyObjectStyles () |
| Apply all styles for an object node.
|
|
Domain * | getDomain () const |
| Returns the domain the object belongs to.
|
|
const Metaclass * | getDynamicMetaclass () const override |
| Returns the metaclass of the dynamic type of the object.
|
|
MainLoopScheduler * | getMainLoopScheduler () const |
| Returns the MainLoopScheduler instance of the associated Domain.
|
|
detail::MessageDispatcher * | getMessageDispatcher () const |
| Returns the message dispatcher of the object.
|
|
ResourceManager * | getResourceManager () const |
| Returns the resource manager of the object.
|
|
ScriptingContextSharedPtr | getScriptingContext () const |
| Gets the scripting context of the object.
|
|
| Object (Domain *domain) |
|
void | setScriptingContext (ScriptingContextSharedPtr context) |
| Sets the scripting context of the object.
|
|
void | unapplyObjectStyle (AppliedStyleEntrySharedPtr appliedStyleEntry) |
|
void | unapplyObjectStyles () |
| Unapplies and removes all applied styles.
|
|
| ~Object () override |
|
bool | isTypeOf (const Metaclass *objectType) const |
| Determines if the type of this object is the given type or derived from it.
|
|
virtual | ~MetaObject () |
|
template<typename DataType > |
void | addPropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner) |
|
template<typename DataType > |
void | addPropertyModifierWithoutNotifyingHandlers (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner) |
| Adds a property modifier without notifying handlers.
|
|
template<typename DataType > |
void | addPropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner) |
|
template<typename DataType > |
void | addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, AbstractPropertyTypeDescriptor::ValueSourceOwner *owner) |
|
template<typename DataType > |
void | addPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, PropertyValuePrecedence precedence, void *ownerPointer) |
|
PropertyStorageContainer::iterator | beginPropertyStorage () |
| Returns the begin iterator to the internal property storage container.
|
|
PropertyStorageContainer::const_iterator | beginPropertyStorage () const |
| Returns the begin iterator to the internal property storage container.
|
|
void | clearPropertyFlag (AbstractPropertyType propertyType, uint32_t flag) |
|
void | copyLocalValue (const PropertyObject &other, AbstractPropertyType propertyType) |
| Copies local value of single property from another object.
|
|
void | copyLocalValues (const PropertyObject &other) |
| Copies all local values from another object.
|
|
PropertyStorageContainer::iterator | endPropertyStorage () |
| Returns the end iterator to the internal property storage container.
|
|
PropertyStorageContainer::const_iterator | endPropertyStorage () const |
| Returns the end iterator to the internal property storage container.
|
|
template<typename DataType > |
PropertyType< DataType >::Traits::ReturnType | getAbstractProperty (AbstractPropertyType abstractPropertyType) const |
|
template<typename DataType > |
PropertyType< DataType >::Traits::ReturnType | getAbstractPropertyBase (AbstractPropertyType abstractPropertyType) const |
|
template<typename DataType > |
optional< typename PropertyType< DataType >::Traits::ReturnType > | getOptionalAbstractProperty (AbstractPropertyType abstractPropertyType) const |
|
template<typename DataType > |
optional< typename PropertyType< DataType >::Traits::ReturnType > | getOptionalProperty (const PropertyType< DataType > &propertyType) const |
| Evaluates the property value in the same way as the overload above but does not default to the value in property metadata if there are no inputs to the property value.
|
|
template<typename DataType > |
optional< typename PropertyType< DataType >::Traits::ReturnType > | getOptionalPropertyBase (const PropertyType< DataType > &propertyType) const |
| Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value.
|
|
template<typename DataType > |
PropertyType< DataType >::Traits::ReturnType | getProperty (const PropertyType< DataType > &propertyType) const |
| Returns the current value of a property type.
|
|
template<typename DataType > |
PropertyType< DataType >::Traits::ReturnType | getPropertyBase (const PropertyType< DataType > &propertyType) const |
| Returns the current value of a property disregarding modifiers.
|
|
template<typename DataType > |
size_t | getPropertyNotificationHandlerCount (const PropertyType< DataType > &propertyType) const |
| Gets number of current notification handlers for given property type.
|
|
bool | hasBaseValue (AbstractPropertyType propertyType) const |
| Evaluates whether there are any inputs into the property value, disregarding modifiers.
|
|
bool | hasLocalValue (AbstractPropertyType propertyType) const |
| Evaluates whether there is a local value set for the property.
|
|
bool | hasNonClassValue (AbstractPropertyType propertyType) const |
| Evaluates whether there is a value of any precedence higher than class default value set for the property.
|
|
bool | hasValue (AbstractPropertyType propertyType) const |
| Evaluates whether there are any inputs into the property value.
|
|
bool | isPropertyFlagSet (AbstractPropertyType propertyType, uint32_t flag) const |
|
| PropertyObject () |
|
void | removeKzbProperties () |
| Remove all KZB properties.
|
|
void | removeKzbProperties (flat_set< AbstractPropertyType > *keepProperties) |
| Remove all KZB properties that are not included in a given set.
|
|
template<typename DataType > |
void | removeLocalPropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *ownerPointer) |
|
void | removeLocalValue (AbstractPropertyType propertyType) |
| Removes the local value associated with the property.
|
|
template<typename DataType > |
void | removePropertyModifier (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::ModifierCallback callback, void *owner) |
|
template<typename DataType > |
void | removePropertyNotificationHandler (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::NotificationCallback callback, void *owner) |
|
template<typename DataType > |
void | removePropertyValueSource (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Descriptor::TypedValueSource *valueSource, void *ownerPointer) |
|
template<typename DataType > |
void | setAbstractProperty (AbstractPropertyType abstractPropertyType, typename PropertyType< DataType >::Traits::ParameterType value) |
|
template<typename DataType > |
void | setProperty (const PropertyType< DataType > &propertyType, typename PropertyType< DataType >::Traits::ParameterType value) |
| Sets the local value of a property type.
|
|
void | setPropertyFlag (AbstractPropertyType propertyType, uint32_t flag) |
|
KZ_DEPRECATED void | validatePropertyModifiers (AbstractPropertyType propertyType) |
| Validates property modifiers and notifies handlers.
|
|
void | validatePropertyModifiersAndNotifyHandlers (AbstractPropertyType propertyType) |
| Validates property modifiers and notifies handlers.
|
|
virtual | ~PropertyObject () |
|
void | addBindingRuntime (AbstractBindingRuntimeSharedPtr entry, shared_ptr< void > owner) |
| Adds an already-created binding runtime to this binding host.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding) |
| Wrapper for setting a binding with no target.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding, AbstractPropertyType propertyType) |
| Wrapper for setting a binding.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding, AbstractPropertyType propertyType, PropertyField field) |
| Wrapper for setting a binding.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding, AbstractPropertyType propertyType, PropertyField field, PropertyValuePrecedence precedence) |
| Wrapper for setting a binding.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding, AbstractPropertyType propertyType, PropertyValuePrecedence precedence) |
| Wrapper for setting a binding.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding, shared_ptr< Node > templateRoot) |
| Sets a binding with no target.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding, shared_ptr< Node > templateRoot, AbstractPropertyType propertyType, PropertyField field) |
| Wrapper for setting a binding.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding, shared_ptr< Node > templateRoot, AbstractPropertyType propertyType, PropertyField field, PropertyValuePrecedence precedence) |
| Wrapper for setting a binding.
|
|
BindingRuntimeHandle | setBinding (AbstractBindingSharedPtr binding, shared_ptr< Node > templateRoot, AbstractPropertyType propertyType, PropertyValuePrecedence precedence) |
| Wrapper for setting a binding.
|
|
BindingRuntimeHandle | setBindingWithOwner (AbstractBindingSharedPtr binding, shared_ptr< void > owner) |
| Wrapper for setting a binding with no target.
|
|
BindingRuntimeHandle | setBindingWithOwner (AbstractBindingSharedPtr binding, shared_ptr< void > owner, AbstractPropertyType propertyType) |
| Wrapper for setting a binding with owner.
|
|
BindingRuntimeHandle | setBindingWithOwner (AbstractBindingSharedPtr binding, shared_ptr< void > owner, AbstractPropertyType propertyType, PropertyField field, PropertyValuePrecedence precedence) |
| Wrapper for setting a binding with owner.
|
|
BindingRuntimeHandle | setBindingWithOwner (AbstractBindingSharedPtr binding, shared_ptr< void > owner, shared_ptr< Node > templateRoot) |
| Sets a binding with no target.
|
|
BindingRuntimeHandle | setBindingWithOwner (AbstractBindingSharedPtr binding, shared_ptr< void > owner, shared_ptr< Node > templateRoot, AbstractPropertyType propertyType, PropertyField field, PropertyValuePrecedence precedence) |
| Sets a binding to a certain property.
|
|
BindingRuntimeHandle | setModifierBinding (AbstractBindingSharedPtr binding, AbstractPropertyType propertyType) |
| Wrapper for setting a modifier binding.
|
|
BindingRuntimeHandle | setModifierBinding (AbstractBindingSharedPtr binding, AbstractPropertyType propertyType, PropertyField field) |
| Wrapper for setting a modifier binding.
|
|
BindingRuntimeHandle | setModifierBinding (AbstractBindingSharedPtr binding, shared_ptr< Node > templateRoot, AbstractPropertyType propertyType, PropertyField field) |
| Wrapper for setting a modifier binding.
|
|
BindingRuntimeHandle | setModifierBindingWithOwner (AbstractBindingSharedPtr binding, shared_ptr< void > owner, AbstractPropertyType propertyType) |
| Wrapper for setting a modifier binding.
|
|
BindingRuntimeHandle | setModifierBindingWithOwner (AbstractBindingSharedPtr binding, shared_ptr< void > owner, AbstractPropertyType propertyType, PropertyField field) |
| Wrapper for setting a modifier binding.
|
|
BindingRuntimeHandle | setModifierBindingWithOwner (AbstractBindingSharedPtr binding, shared_ptr< void > owner, shared_ptr< Node > templateRoot, AbstractPropertyType propertyType, PropertyField field) |
| Sets a modifier binding.
|
|
BindingRuntimeConstIterator | beginBindingRuntimes () const |
| Returns an iterator to the beginning of binding runtimes.
|
|
BindingRuntimeConstIterator | endBindingRuntimes () const |
| Returns an iterator to the end of binding runtimes.
|
|
AbstractBindingRuntimeSharedPtr | getBindingRuntime (size_t idx) |
| Gets binding by index.
|
|
size_t | getBindingRuntimeCount () const |
| Gets the number of binding runtimes added to this node.
|
|
void | removeAllBindings () |
| Removes all binding runtimes.
|
|
void | removeBinding (BindingRuntimeHandle &bindingRuntime) |
| Removes a binding runtime added earlier.
|
|
void | removeBindingsWithOwner (shared_ptr< void > owner) |
| Removes all binding runtimes with the specified owner.
|
|
Base class for Kanzi nodes.
Kanzi messages
Use the interface provided by Node to dispatch messages and enable the nodes in the node tree to react to messages.
When you dispatch a message it travels in two phases: first tunneling, then bubbling. During the tunneling phase the message travels from the root node to the node where the message originated. From there the message bubbles back to the root node.
When you want a node to react to a message when that message passes, add message handlers or filters to those nodes. A message filter intercepts messages from any node while a message handler listens only to messages from a specific source node. To register message handlers and filters that react to:
To remove all types of handlers and filters use Node::removeMessageHandler().
To dispatch a single message, use Node::dispatchMessage().
Examples
To define a simple example node, one message type, two callbacks which are suitable for message handlers and a counting mechanism to verify the callback invocations:
static int callCount = 0;
class ExampleNode : public EmptyNode2D
{
public:
static MessageType<MessageArguments> exampleMessageType;
static ExampleNodeSharedPtr create(Domain* domain, string_view name)
{
ExampleNodeSharedPtr node = make_polymorphic_shared_ptr<EmptyNode2D>(new ExampleNode(domain, name));
node->initialize();
return node;
}
void exampleNodeCallback(MessageArguments& message)
{
message.setHandled(false);
++callCount;
}
private:
explicit ExampleNode(Domain* domain, string_view name) :
EmptyNode2D(domain, name)
{
}
};
void exampleCallback(MessageArguments& message)
{
message.setHandled(false);
++callCount;
}
MessageType<MessageArguments> ExampleNode::exampleMessageType(
kzMakeFixedString(
"ExampleNode.exampleMessageType"),
nullptr);
To add a handler that consumes the messages sent by the node itself with Node::addMessageHandler():
ExampleNodeSharedPtr node = ExampleNode::create(domain, "node");
Node::MessageSubscriptionToken token = node->addMessageHandler(ExampleNode::exampleMessageType, &exampleCallback);
To remove the handler with Node::removeMessageHandler():
node->removeMessageHandler(token);
To add a bubbling handler with Node::addMessageHandler():
node->addChild(child);
Node::MessageSubscriptionToken bubblingToken = node->addMessageHandler(ExampleNode::exampleMessageType, function<void(MessageArguments&)>(&exampleCallback), child.get());
To remove a bubbling handler with Node::removeMessageHandler():
node->removeMessageHandler(bubblingToken);
To add a tunneling filter with Node::addTunnelingFilter():
Node::MessageSubscriptionToken tunnelingToken = node->addTunnelingFilter(ExampleNode::exampleMessageType, node.get(), &ExampleNode::exampleNodeCallback);
To remove a tunneling filter with Node::removeMessageHandler():
node->removeMessageHandler(tunnelingToken);
To dispatch a message use Node::dispatchMessage():
MessageArguments message;
child->dispatchMessage(ExampleNode::exampleMessageType, message);
Property types
Examples
To set node properties:
objectNode = EmptyNode3D::create(domain, "TestNode");
objectNode->setProperty(Node::NameProperty, "NewTestNodeName");
objectNode->setProperty(Node::WidthProperty, 25);
objectNode->setProperty(Node::HorizontalAlignmentProperty, Node::HorizontalAlignmentCenter);
objectNode->setProperty(Node::HorizontalMarginProperty, Vector2(5, 7));
objectNode->setProperty(Node::VisibleProperty, false);
objectNode->setProperty(Node::FontFamilyProperty, localFontFamily);
string name = objectNode->getProperty(Node::NameProperty);
float width = objectNode->getProperty(Node::WidthProperty);
Node::HorizontalAlignment hAlign = objectNode->getProperty(Node::HorizontalAlignmentProperty);
Vector2 hMargin = objectNode->getProperty(Node::HorizontalMarginProperty);
bool visible = objectNode->getProperty(Node::VisibleProperty);
To introduce new message types and use them:
template<typename ArgType>
class MyMessageArguments : public MessageArguments
{
public:
static PropertyType<ArgType> ArgumentType;
};
template<> PropertyType<
int> MyMessageArguments<
int>::ArgumentType(
kzMakeFixedString("
int argument"));
template<> PropertyType<
bool> MyMessageArguments<
bool>::ArgumentType(
kzMakeFixedString("
bool argument"));
template<> PropertyType<Vector2> MyMessageArguments<Vector2>::ArgumentType(
kzMakeFixedString("Vector2 argument"));
template<> PropertyType<Matrix3x3> MyMessageArguments<Matrix3x3>::ArgumentType(
kzMakeFixedString("Matrix3x3 argument"));
template<> PropertyType<Matrix4x4> MyMessageArguments<Matrix4x4>::ArgumentType(
kzMakeFixedString("Matrix4x4 argument"));
class MyNode : public Node2D
{
public:
static shared_ptr<MyNode> create(Domain* domain, string_view name)
{
shared_ptr<MyNode> node = shared_ptr<MyNode>(new MyNode(domain, name));
node->initialize();
return node;
}
void onAttached() override
{
Node2D::onAttached();
MessageSubscriptionToken intToken = addMessageHandler(MyIntMessage, this, &MyNode::intMessageHandler);
addMessageFilter(MyIntMessage, this, &MyNode::intMessageFilter);
MessageSubscriptionToken boolToken = addMessageHandler(MyBoolMessage, this, &MyNode::boolMessageHandler);
addMessageFilter(MyBoolMessage, this, &MyNode::boolMessageFilter);
MessageSubscriptionToken vector2Token = addMessageHandler(MyVector2Message, this, &MyNode::vector2MessageHandler);
addMessageFilter(MyVector2Message, this, &MyNode::vector2MessageFilter);
MessageSubscriptionToken matrix3x3Token = addMessageHandler(MyMatrix3x3Message, this, &MyNode::matrix3x3MessageHandler);
addMessageFilter(MyMatrix3x3Message, this, &MyNode::matrix3x3MessageFilter);
MessageSubscriptionToken matrix4x4Token = addMessageHandler(MyMatrix4x4Message, this, &MyNode::matrix4x4MessageHandler);
addMessageFilter(MyMatrix4x4Message, this, &MyNode::matrix4x4MessageFilter);
MyMessageArguments<int> intMessage;
intMessage.setArgument(intMessage.ArgumentType, 123);
dispatchMessage(MyIntMessage, intMessage);
MyMessageArguments<bool> boolMessage;
boolMessage.setArgument(boolMessage.ArgumentType, true);
dispatchMessage(MyBoolMessage, boolMessage);
MyMessageArguments<Vector2> vector2Message;
vector2Message.setArgument(vector2Message.ArgumentType, Vector2(123.0f, 321.0f));
dispatchMessage(MyVector2Message, vector2Message);
MyMessageArguments<Matrix3x3> matrix3x3Message;
matrix3x3Message.setArgument(matrix3x3Message.ArgumentType, Matrix3x3());
dispatchMessage(MyMatrix3x3Message, matrix3x3Message);
MyMessageArguments<Matrix4x4> matrix4x4Message;
matrix4x4Message.setArgument(matrix4x4Message.ArgumentType, Matrix4x4());
dispatchMessage(MyMatrix4x4Message, matrix4x4Message);
assertEquals(10u, m_callCounter);
removeMessageHandler(intToken);
removeMessageHandler(boolToken);
removeMessageHandler(vector2Token);
removeMessageHandler(matrix3x3Token);
removeMessageHandler(matrix4x4Token);
}
void intMessageHandler(MyMessageArguments<int>& args)
{
assertEquals(args.getArgument(args.ArgumentType), 123);
++m_callCounter;
args.setHandled(false);
}
void intMessageFilter(MyMessageArguments<int>& args)
{
assertEquals(args.getArgument(args.ArgumentType), 123);
++m_callCounter;
}
void boolMessageHandler(MyMessageArguments<bool>& args)
{
assertTrue(args.getArgument(args.ArgumentType));
++m_callCounter;
args.setHandled(false);
}
void boolMessageFilter(MyMessageArguments<bool>& args)
{
assertTrue(args.getArgument(args.ArgumentType));
++m_callCounter;
}
void vector2MessageHandler(MyMessageArguments<Vector2>& args)
{
Vector2 argument = args.getArgument(args.ArgumentType);
assertEquals(argument[0], 123.0f);
assertEquals(argument[1], 321.0f);
++m_callCounter;
args.setHandled(false);
}
void vector2MessageFilter(MyMessageArguments<Vector2>& args)
{
Vector2 argument = args.getArgument(args.ArgumentType);
assertEquals(argument[0], 123.0f);
assertEquals(argument[1], 321.0f);
++m_callCounter;
}
void matrix3x3MessageHandler(MyMessageArguments<Matrix3x3>& args)
{
Matrix3x3 identity = Matrix3x3::createIdentity();
Matrix3x3 argument = args.getArgument(args.ArgumentType);
for (int i = 0; i < 9; ++i)
{
assertEquals(argument[i], identity[i]);
}
++m_callCounter;
args.setHandled(false);
}
void matrix3x3MessageFilter(MyMessageArguments<Matrix3x3>& args)
{
Matrix3x3 identity = Matrix3x3::createIdentity();
Matrix3x3 argument = args.getArgument(args.ArgumentType);
for (int i = 0; i < 9; ++i)
{
assertEquals(argument[i], identity[i]);
}
++m_callCounter;
}
void matrix4x4MessageHandler(MyMessageArguments<Matrix4x4>& args)
{
Matrix4x4 identity = Matrix4x4::createIdentity();
Matrix4x4 argument = args.getArgument(args.ArgumentType);
for (int i = 0; i < 16; ++i)
{
assertEquals(argument[i], identity[i]);
}
++m_callCounter;
args.setHandled(false);
}
void matrix4x4MessageFilter(MyMessageArguments<Matrix4x4>& args)
{
Matrix4x4 identity = Matrix4x4::createIdentity();
Matrix4x4 argument = args.getArgument(args.ArgumentType);
for (int i = 0; i < 16; ++i)
{
assertEquals(argument[i], identity[i]);
}
++m_callCounter;
}
static MessageType<MyMessageArguments<int> > MyIntMessage;
static MessageType<MyMessageArguments<bool> > MyBoolMessage;
static MessageType<MyMessageArguments<Vector2> > MyVector2Message;
static MessageType<MyMessageArguments<Matrix3x3> > MyMatrix3x3Message;
static MessageType<MyMessageArguments<Matrix4x4> > MyMatrix4x4Message;
private:
explicit MyNode(Domain* domain, string_view name):
Node2D(domain, name),
m_callCounter(0)
{
}
unsigned int m_callCounter;
};
MessageType<MyMessageArguments<int> > MyNode::MyIntMessage(
kzMakeFixedString(
"IntMessage"),
nullptr);
MessageType<MyMessageArguments<bool> > MyNode::MyBoolMessage(
kzMakeFixedString(
"BoolMessage"),
nullptr);
MessageType<MyMessageArguments<Vector2> > MyNode::MyVector2Message(
kzMakeFixedString(
"Vector2Message"),
nullptr);
MessageType<MyMessageArguments<Matrix3x3> > MyNode::MyMatrix3x3Message(
kzMakeFixedString(
"Matrix3x3Message"),
nullptr);
MessageType<MyMessageArguments<Matrix4x4> > MyNode::MyMatrix4x4Message(
kzMakeFixedString(
"Matrix4x4Message"),
nullptr);